#include <windows.h>
//#include "src/vmarray.h"
#include "DIVA_VM.h"

int maxNum ;
int maxLevel ;
string names ;
bool bCancel;
bool bAutoApply = false ;

#define NUM_DEFAULT 20
#define LEVEL_DEFAULT 5


void buttonManage(WPARAM wParam, HWND hDlg){
	/*
	switch (LOWORD(wParam)) {
		case EXP_AUTOAPPLY_RADIO:
			if (bAutoApply) bAutoApply = false ;
			else bAutoApply = true ;
			//GetDlgItemInt(hDlg, EXP_AUTOAPPLY_RADIO, &bAuto, FALSE);
			break ;

		case IDCANCEL:
			bCancel = true;
			EndDialog(hDlg, TRUE);
			break ;
		case IDOK:
			BOOL bSuccess;
			maxNum = GetDlgItemInt(hDlg, IDC_NUM, &bSuccess, FALSE);
			maxLevel = GetDlgItemInt(hDlg, IDC_LEVEL, &bSuccess, FALSE);

			int len;
			len = GetWindowTextLength(GetDlgItem(hDlg, IDC_NAMES));
			if(len > 0){
				char* buf;
				buf = (char*)GlobalAlloc(GPTR, len + 1);
				GetDlgItemText(hDlg, IDC_NAMES, buf, len + 1);
				names = buf;
				GlobalFree((HANDLE)buf);
			}
			EndDialog(hDlg, TRUE);
			break ;
	}
	*/
}


void initialExpValue(HWND hDlg){
	maxNum = -1;
	maxLevel = -1;
	names = "";	
	bCancel = false;
	bAutoApply = false ;
	/*
	SetDlgItemInt(hDlg, IDC_LEVEL, LEVEL_DEFAULT, FALSE);
	SetDlgItemInt(hDlg, IDC_NUM, NUM_DEFAULT, FALSE);
	*/
}

BOOL CALLBACK ExpDialog( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	HDC hDC ;
	HWND selectItem;
	LPDRAWITEMSTRUCT lpdis;
	int selectIndex;


	switch (message) {

		case WM_INITDIALOG:
			initialExpValue(hDlg);
			break;
		case WM_PAINT:
			break;

		case WM_COMMAND: 
			buttonManage(wParam, hDlg);	
			return (TRUE);

		case WM_DRAWITEM:
			lpdis = (LPDRAWITEMSTRUCT) lParam;
			return (TRUE);
	}
	return (FALSE); 
}